package com.linko.intelligent.remote.core.controller;

import com.linko.intelligent.base.CommonResponse;
import com.linko.intelligent.remote.core.service.DeviceOnlineService;
import com.linko.intelligent.remote.pojo.query.DeviceOnlineQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author yuan
 * @create 2024/3/15 11:42
 */
@RestController
@RequestMapping("/deviceOnline")
@Api(value = "DeviceOnlineController", tags = "设备在线时长")
public class DeviceOnlineController {

    @Autowired
    DeviceOnlineService deviceService;


    /***
     * 设备分页
     * @param
     * @return
     */
    @ApiOperation("设备列表")
    @GetMapping(value = "/page")
    public CommonResponse page(@Param("query") DeviceOnlineQuery query) {
        return new CommonResponse(CommonResponse.SUCCESS, "", deviceService.page(query));
    }

    /***
     * 设备列表
     * @param
     * @return
     */
    @ApiOperation("设备列表")
    @GetMapping(value = "/list")
    public CommonResponse list(@Param("query") DeviceOnlineQuery query) {
        return new CommonResponse(CommonResponse.SUCCESS, "", deviceService.deviceList(query));
    }


}
